package com.gaocf.designpatterns.behavior.strategy;

/**
 * @author gaocf
 * 测试Demo
 */
public class Demo {
    public static void main(String[] args) {
        Cash cash = CashFactory.createCashObject(1);
        System.out.println("简单工厂设计模式 type 1 => " + cash.calculateRealCash(100));

        cash = CashFactory.createCashObject(2);
        System.out.println("简单工厂设计模式 type 2 => " + cash.calculateRealCash(100));

        cash = CashFactory.createCashObject(3);
        System.out.println("简单工厂设计模式 type 3 => " + cash.calculateRealCash(100));

        System.out.println("--------------------------------------------------------");

        CashContext cashContext = new CashContext(1);
        System.out.println("策略设计模式 type 1 => " + cashContext.getRealMoney(100));

        cashContext = new CashContext(2);
        System.out.println("策略设计模式 type 2 => " + cashContext.getRealMoney(100));

        cashContext = new CashContext(3);
        System.out.println("策略设计模式 type 3 => " + cashContext.getRealMoney(100));
    }
}
